package ch.bfh.abcmmh.view.main.simulationparameterframe;

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JPanel;

import ch.bfh.abcmmh.view.GUIController;
import ch.bfh.abcmmh.view.main.MiniFrame;
import ch.bfh.abcmmh.view.main.simulationparameterframe.subpanels.GlobalAggressivityPanel;
import ch.bfh.abcmmh.view.main.simulationparameterframe.subpanels.MayBeParameterPanel;
import ch.bfh.abcmmh.view.main.simulationparameterframe.subpanels.SimulationSpeedPanel;
import ch.bfh.abcmmh.view.main.simulationparameterframe.subpanels.VehiclePossibilityPanel;
import ch.bfh.abcmmh.view.main.simulationparameterframe.subpanels.VehicleVariabilityPanel;

public class ParameterFrame extends MiniFrame {
	private static final long serialVersionUID = 1L;

	private VehiclePossibilityPanel vehiclePossibilityPanel;
	private VehicleVariabilityPanel variabilityPanel;
	private GlobalAggressivityPanel aggressivityPanel;
	private MayBeParameterPanel mayBeParameterPanel;
	
	private SimulationSpeedPanel speedPanel;

	public ParameterFrame(GUIController guiController, String title) {
		super(title);
		this.setLayout(new BorderLayout());
		this.setSize(500, 550);
		
		this.vehiclePossibilityPanel = new VehiclePossibilityPanel(guiController);
		this.mayBeParameterPanel = new MayBeParameterPanel(guiController);
		this.add(new Layouthelper2(), BorderLayout.NORTH);
		
		this.variabilityPanel = new VehicleVariabilityPanel(guiController);
		this.add(variabilityPanel, BorderLayout.CENTER);
		
		this.speedPanel = new SimulationSpeedPanel(guiController);
		this.aggressivityPanel = new GlobalAggressivityPanel(guiController);
		this.add(new LayoutHelper(), BorderLayout.SOUTH);
	}

	private class LayoutHelper extends JPanel{
		
		private static final long serialVersionUID = 1L;

		private LayoutHelper(){
			 setLayout(new GridLayout(2, 1));
		
			 add(aggressivityPanel);
			 add(speedPanel);
		 }
	}
	
	private class Layouthelper2 extends JPanel{
		
		private static final long serialVersionUID = 1L;

		private Layouthelper2(){
			setLayout(new BorderLayout());
			add(vehiclePossibilityPanel, BorderLayout.NORTH);
			add(mayBeParameterPanel, BorderLayout.SOUTH);
		}
	}
}
